//
//  AppDelegate.m
//  LWShopItem
//
//  Created by mac on 17/3/14.
//  Copyright © 2017年 LWShop.com. All rights reserved.
//

#import "AppDelegate.h"
#import "LWMainTabBarController.h"
#import "LaunchIntroductionView.h"

#import "DWWXSDK.h"

#define APP_ID @"wxd21cf7d764a8a393"
#define APP_SECRET @"88704af549141ff62c5b1413f1697981"


@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    
    [SVProgressHUD setMinimumDismissTimeInterval:1.5];
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark]; // 弹框的样式
    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeNative];// 圆圈的转动动作
    
    [HYBNetworking updateBaseUrl:@"http://shop.sdlinwang.com/"];
    
    [HYBNetworking enableInterfaceDebug:YES];
    
    _window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    LWMainTabBarController *vc = [LWMainTabBarController new];
    
    _window.rootViewController = vc;
    
    [_window makeKeyAndVisible];
    
    
    
    
#if 1
    [LaunchIntroductionView sharedWithImages:@[@"launch0.png",@"launch1.png",@"launch2.png",@"launch3.png"]];
#elif 0
    [LaunchIntroductionView sharedWithImages:@[@"launch0.png",@"launch1.png",@"launch2.png",@"launch3.png"] buttonImage:@"login" buttonFrame:CGRectMake(kScreen_width/2 - 551/4, kScreen_height - 150, 551/2, 45)];
#elif 0
    LaunchIntroductionView *launch = [LaunchIntroductionView sharedWithImages:@[@"launch0.png",@"launch1.png",@"launch2.png",@"launch3.pgn"] buttonImage:@"login" buttonFrame:CGRectMake(kScreen_width/2 - 551/4, kScreen_height - 150, 551/2, 45)];
    launch.currentColor = [UIColor redColor];
    launch.nomalColor = [UIColor greenColor];
#else
    //只有在存在该storyboard时才调用该方法，否则会引起crash
    [LaunchIntroductionView sharedWithStoryboard:@"Main" images:@[@"launch0.png",@"launch1.png",@"launch2.png",@"launch3.png"] buttonImage:@"login" buttonFrame:CGRectMake(kScreen_width/2 - 551/4, kScreen_height - 150, 551/2, 45)];
    
    
#endif
    
    NSLog(@"/*****************************此文件基于微信SDK 1.7.7版本******************************/");
    NSLog(@"是否安装微信:%d", [DWWXSDK dw_isWXAppInstalled]);
    NSLog(@"是否支持OpenApi:%d", [DWWXSDK dw_isWXAppSupportApi]);
    NSLog(@"微信的itunes安装地址:%@", [DWWXSDK dw_getWXAppInstallUrl]);
    NSLog(@"当前微信SDK的版本号:%@", [DWWXSDK dw_getApiVersion]);
    [DWWXSDK dw_registerApp:@"wxd21cf7d764a8a393"];
    
    return YES;
}

//****************************微信登录和支付**************************************************

// openURL
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    
    return [WXApi handleOpenURL:url delegate:[DWWXSDK wxSDK]];
    
}

// handleURL
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    
    return [WXApi handleOpenURL:url delegate:[DWWXSDK wxSDK]];

}

//此方法是由于系统版本更新而出现的方法
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary*)options{
    
    return [WXApi handleOpenURL:url delegate:[DWWXSDK wxSDK]];
    
}

//****************************微信登录和支付**************************************************




@end
